import { toRefs } from 'vue'

const tabbarNode = uni.upx2px(146)
const safeHeight = useSafeHeight()

export function useScrollViewHeight(withTabbar = true) {
    const systermInfo = uni.getSystemInfoSync()
    console.log(systermInfo)
    console.log(systermInfo.windowHeight)
    console.log(systermInfo.screenHeight)
    let height = ''
    // #ifdef H5
    height = `${systermInfo.windowHeight - (withTabbar ? tabbarNode : 0)}px`
    // #endif
    // #ifndef H5
    height = `${systermInfo.screenHeight - 50 - safeHeight.value}px`
    // #endif
    return toRefs({ scrollViewHeight: height })
}
